<!DOCTYPE html>
<html>
<head>
    <include file="Common/admin_meta" />
    <title>提交认证 - {$_ENV['site'][0]['title']}</title>
    <include file="Common/admin_link" />
</head>

<body>
<div id="content" class="econtent">

    <div class="econtent-body mycontainer">
        <div class="row-col">
            <ul class="breadcrumb tc-breadcrumb">
                <li><a href="/home">首页</a></li>
                <li class="active">提交认证</li>
            </ul>
        </div>
        <div class="row-col">
            <div class="card card-ead">
                <div class="card-header">
                    <div class="card-title">提交认证</div>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-sm-12">
                            <?php
                        //dump($data);
                        ?>
                            <form class="form-horizontal tc-form">
                                <div class="form-group">
                                    <label class="control-label col-sm-4">学生姓名</label>
                                    <div class="col-sm-4">
                                        <p class="form-control-static">{$data['name']}</p>
                                    </div>
                                </div>
                                <div class="form-group">
                                <label class="col-sm-4 control-label">性别</label>
                                <div class="col-sm-4">
                                    <label class="radio-inline"><input type="radio" checked name="sex"> 男</label>
                                    <label class="radio-inline"><input type="radio" name="sex"> 女</label>
                                </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-4">学校</label>
                                    <div class="col-sm-4">
                                        <input id="school" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-4">专业</label>
                                    <div class="col-sm-4">
                                        <input id="profession" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-4">年级</label>
                                    <div class="col-sm-4">
                                        <input id="grade" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-4">学号</label>
                                    <div class="col-sm-4">
                                        <input id="stu_id" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-4">籍贯</label>
                                    <div class="col-sm-4">
                                        <input id="area" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-4">联系电话</label>
                                    <div class="col-sm-4">
                                        <input id="phone" class="form-control" type="">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-4">邮箱</label>
                                    <div class="col-sm-4">
                                        <input id="email" class="form-control" >
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-4">个人简介</label>
                                    <div class="col-sm-4">
                                        <textarea id="intro" class="form-control" rows="3"></textarea>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-4"></label>
                                    <div class="col-sm-4">
                                        <input id="save" class="btn btn-primary" value="提交认证" type="button">
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>

</div>

<include file="Common/admin_script" />
<script src="__PUBLIC__/asset/lib/typeahead/typeahead.js"></script>
<script>
    var page = {
        name: "{$data['name']}"
    };
    $('#save').on('click', function (e) {
        e.preventDefault();
        var sex = $("#sex input[name='sex']:checked").val();
        var school = $('#school').val();
        if (!school) {
            eui.msg('学校不能为空');
            return false;
        }
        var area = $('#area').val();
        if (!area) {
            eui.msg('籍贯不能为空');
            return false;
        }
        var stuid = $('#stu_id').val();
        if (!stuid) {
            eui.msg('学号不能为空');
            return false;
        }
        var grade = $('#grade').val();
        if (!grade) {
            eui.msg('年级不能为空');
            return false;
        }   
        var profession = $('#profession').val();
        if (!profession) {
            eui.msg('年级不能为空');
            return false;
        }  

        var phone = $('#phone').val();
        if(!phone) {
            eui.msg('电话不能为空');
            return false;
        }
        var email = $('#email').val();
        if(!email) {
            eui.msg('邮箱不能为空');
            return false;
        }
        var intro = $('#intro').val();
        if(!intro){
            eui.msg('个人简介不能为空');
            return false;
        }

        $.ajax({
            url: '/user/sendVerify',
            type: 'POST',
            dataType: 'json',
            data: {
                name: page.name,
                sex: sex,
                area: area,
                school: school,
                professional: profession,
                stuid: stuid,
                grade: grade,
                phone: phone,
                email: email,
                intro: intro
            },
            success: function (obj) {
                if (obj.code === 0) {
                    eui.msg('提交认证成功');
                    setTimeout(function(){
                        window.location.href="/user/verifyStatus";
                    }, 1000)
                } else {
                    eui.smg('提交认证失败，' + obj.msg);
                }
            },
            error: function () {
                eui.alert('系统出错');
            }
        });

    });


</script>
</body>
</html>